import searchapi from '@/api/searchapi'

const searchModuleObj = {
  state: {
    searchArray: []
  },
  actions: {
    async search ({commit}, keyword) {
      let data = await searchapi.get(keyword)
      commit('flushSearchArray', data)
    }
  },
  mutations: {
    flushSearchArray (state, payload) {
      state.searchArray = payload
    }
  }
}

export default searchModuleObj
